package gamePack;

import gamePack.entities.EntityA;
import gamePack.entities.EntityB;

import java.awt.Graphics;
import java.util.LinkedList;

public class Controller {

	private LinkedList<EntityA> entA = new LinkedList<EntityA>();
	private LinkedList<EntityB> entB = new LinkedList<EntityB>();

	private Game game;

	private EntityA entityA;
	private EntityB entityB;

	public Controller(Game game) {
		this.game = game;

	}

	public void createEnemy(int enemy_count) {
		for (int i = 0; i < enemy_count; i++) {
			game.crearEnemigo();
		}
	}

	public void tick() {
		// CLASE A
		for (int i = 0; i < entA.size(); i++) {
			entityA = entA.get(i);

			entityA.tick();
		}

		// CLASE B
		for (int i = 0; i < entB.size(); i++) {
			entityB = entB.get(i);

			entityB.tick();
		}
	}

	public void render(Graphics g) {
		// CLASE A
		for (int i = 0; i < entA.size(); i++) {
			entityA = entA.get(i);

			entityA.render(g);
		}

		// CLASE B
		for (int i = 0; i < entB.size(); i++) {
			entityB = entB.get(i);

			entityB.render(g);
		}
	}

	public void addEntity(EntityA entity) {
		entA.add(entity);
	}

	public void removeEntity(EntityA entity) {
		entA.remove(entity);
	}

	public void addEntity(EntityB entity) {
		entB.add(entity);
	}

	public void removeEntity(EntityB entity) {
		entB.remove(entity);
	}

	public LinkedList<EntityA> getEntityAList() {
		return entA;
	}

	public LinkedList<EntityB> getEntityBList() {
		return entB;
	}
}
